<include file="../Public/header" />

<link href="__PUBLIC__/themes/blue/layout.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="__PUBLIC__/js/tbox/tbox.js" ></script>

<link type="text/css" href="__PUBLIC__/js/jquery-ui-1.8/development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" />
<link type="text/css" href="__PUBLIC__/js/jquery-ui-1.8/development-bundle/demos/demos.css" rel="stylesheet" />
<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.8/development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.8/development-bundle/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.8/development-bundle/ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.8/development-bundle/ui/i18n/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript">
$(function() {
	var dates = $('#outUser_from, #outUser_to, #user_cate_from, #user_cate_to, #outAppCate_from, #outAppCate_to')
	.datepicker( {
		changeMonth: true,
		dateFormat: "yy-mm-dd",
		regional: "zh-CN"
	} );
	
	clearCate('ask');
	clearCate('bbs');
	clearCate('wiki');
});
</script>
</head>
<body>
<div id="container_s">
    <form id="form1" name="form1" method="post" action="{:U('admin/Contribute/outUser')}">
        <table cellspacing="0" cellpadding="4" border="0" width="100%" class="form">
            <tr class="top">
                <td class="tit" colspan="4">用户总体贡献</td>
            </tr>
            <tr>
                <th width="160" valign="top" class="th">起此时间：</th>
                <td class="td"><p>
                        <label>
                            <input type="text" style="width:250px;" name="from" id="outUser_from" />
                        </label>
                    </p>
                    <p>（格式：2010-4-28）</p></td>
                <th valign="top" class="th">结束时间：</th>
                <td class="td"><p>
                        <label>
                            <input type="text" style="width:250px;" name="to" id="outUser_to" />
                        </label>
                    </p>
                    <p>（格式：2010-5-15）</p></td>
            </tr>
            <tr>
                <th valign="top"> </th>
                <td class="td"><input type="submit" value="导出用户总体贡献" id="button" class="button" name="button"/></td>
            </tr>
        </table>
    </form>
    <form id="form1" name="form1" method="post" action="{:U('admin/Contribute/outUserCate')}">
        <table cellspacing="0" cellpadding="4" border="0" width="100%" class="form">
            <tr class="top">
                <td class="tit" colspan="4">各应用用户贡献报表</td>
            </tr>
            <tr>
                <th width="160" valign="top" class="th">起此时间：</th>
                <td class="td"><p>
                        <label>
                            <input type="text" style="width:250px;" name="from" id="user_cate_from" />
                        </label>
                    </p>
                    <p>（格式：2010-4-28）</p></td>
                <th valign="top" class="th">结束时间：</th>
                <td class="td"><p>
                        <label>
                            <input type="text" style="width:250px;" name="to" id="user_cate_to" />
                        </label>
                    </p>
                    <p>（格式：2010-5-15）</p></td>
            </tr>
            <tr>
                <th width="160" valign="top" class="th">选择应用：</th>
                <td class="td"><p>只取到
                        <select name="ask_num" id="ask_num" onChange="changNum('ask')">
                            <option value="1" selected="selected">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                        </select>
                        级知道分类
                        <input id="user_cate_ask"  type="checkbox" value="ask"  onclick="selectCate('ask')" />
                        知道 </p>
                    <p>只取到
                        <select name="bbs_num" id="bbs_num" onChange="changNum('bbs')">
                            <option value="1">1</option>
                            <option value="2" selected="selected">2</option>
                            <option value="3">3</option>
                        </select>
                        级论坛分类
                        <input id="user_cate_bbs"  type="checkbox" value="bbs"  onclick="selectCate('bbs')" />
                        论坛 </p>
                    <p>只取到
                        <select name="wiki_num" id="wiki_num" onChange="changNum('wiki')">
                            <option value="1">1</option>
                            <option value="2" selected="selected">2</option>
                            <option value="3">3</option>
                        </select>
                        级百科分类
                        <input id="user_cate_wiki" type="checkbox" value="wiki" onClick="selectCate('wiki')" />
                        百科 </p></td>
                <th width="160" valign="top" class="th">分类：</th>
                <td class="td">
                    <p>
                        <span id="ask_Html"></span>
                    </p>
                    <p>
                        <span id="bbs_Html"></span>
                    </p>
                    <p>
                        <span id="wiki_Html"></span>
                    </p>
                    <input type="hidden" name="ask_Id" id="ask_Id" />
                    <input type="hidden" name="bbs_Id" id="bbs_Id" />
                    <input type="hidden" name="wiki_Id" id="wiki_Id" />
                    <input type="hidden" name="ask_title" id="ask_title" />
                    <input type="hidden" name="bbs_title" id="bbs_title" />
                    <input type="hidden" name="wiki_title" id="wiki_title" /></td>
            </tr>
            <tr>
                <th valign="top"> </th>
                <td class="td"><label>
                        <input type="hidden" name="cateText" id="cateText" />
                        <input type="submit" value="导出贡献报表" id="button" class="button" name="button"/>
                    </label></td>
            </tr>
        </table>
    </form>
    <form id="form1" name="form1" method="post" action="{:U('admin/Contribute/outAppCate')}">
        <table cellspacing="0" cellpadding="4" border="0" width="100%" class="form">
            <tr class="top">
                <td class="tit" colspan="4">各应用行业贡献报表</td>
            </tr>
            <tr>
                <th width="160" valign="top" class="th">起此时间：</th>
                <td class="td"><p>
                        <label>
                            <input type="text" style="width:250px;" name="from" id="outAppCate_from" />
                        </label>
                    </p>
                    <p>（格式：2010-4-28）</p></td>
                <th valign="top" class="th">结束时间：</th>
                <td class="td"><p>
                        <label>
                            <input type="text" style="width:250px;" name="to" id="outAppCate_to" />
                        </label>
                    </p>
                    <p>（格式：2010-5-15）</p></td>
            </tr>
            <tr>
                <th width="160" valign="top" class="th">选择应用：</th>
                <td class="td"><label>
                        <select name="app">
                            <option value="ask">知道</option>
                            <option value="bbs">论坛</option>
                            <option value="wiki">百科</option>
                            <option value="blog">博客</option>
                            <option value="group">团队</option>
                        </select>
                    </label></td>
                <th width="160" valign="top" class="th">&nbsp;</th>
                <td class="td">&nbsp;</td>
            </tr>
            <tr>
                <th valign="top"> </th>
                <td class="td"><label>
                        <input type="submit" value="导出行业贡献报表" id="button" class="button" name="button"/>
                    </label></td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>
<script type="text/javascript">
var app = 'ask';

function changNum(ts_app){
	clearCate(ts_app);
}
//选择分类
function selectCate(ts_app){
	app = ts_app;	

	var check = $('#user_cate_'+app).attr("checked");
	if(check==true){
		switch(app){
			case 'ask': 
				var url = "{:U('ask/Index/selectCategory')}";
				$.tbox.popup(url,"请选择分类",true);
				break;
			case 'bbs': 
				var url = "{:U('bbs/Index/selectCategory')}";
				$.tbox.popup(url,"请选择分类",false);	
				break;
			default: 
				var url = "{:U('wiki/Index/selectCategory')}";
				$.tbox.popup(url,"请选择分类",true);	
		}
	}else{
		clearCate(app);
	}
}

function clearCate(ts_app){
	$('#'+ts_app+'_Html').html('');
	$('#'+ts_app+'_Id').val('');
	$('#'+ts_app+'_title').val('');
	$('#user_cate_'+ts_app).attr("checked", false);
}

//确定选择
function ok(){	
	var categoryId    = new Array();
	var categoryTitle = new Array();	
	var cate_num = $("#"+app+"_num").val();

	for(i=0;i<5;i++){
		if(i >= cate_num) break;
		
		var value = $("#sel"+i).val();
		if(typeof(value)=='undefined'||value=='' || value==null) break;
		
		categoryId[i]     = value;
		categoryTitle[i]  = $("#sel"+i+" option[value="+value+"]").html();	
	}
		
	if( categoryId.length < 1 ){
		alert('请选择分类',"选择分类失败");
		return false;
	}else{
		 var category_title = categoryTitle.join(' > ');
		 var category_id    = categoryId.join(',');

		 $('#'+app+'_Id').val(category_id);
		 $('#'+app+'_title').val(category_title);
		 $('#'+app+'_Html').html(category_title);
		 $.tbox.close();
	 }
}
</script>